package com.transaction.manage.localMapper;

import com.transaction.manage.model.dto.ChannelInfo;
import com.transaction.manage.model.vo.ComboboxVo;
import com.transaction.manage.myMapper.MyMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ChannelInfoMapper extends MyMapper<ChannelInfo> {

    @Update("UPDATE channel_info SET valid_flag = '00' ,check_flag = '00' WHERE channel_code = #{channelCode}")
    void deleteChannel(String channelCode);

    @Update("UPDATE channel_info SET check_flag = '01' WHERE channel_code = #{channelCode}")
    void checkChannel(String channelCode);

    List<ChannelInfo> selectChannelInfoList(ChannelInfo channelInfo);

    void insertChannelInfo(ChannelInfo channelInfo);

    void updateChannelInfo(ChannelInfo channelInfo);

    @Select("SELECT channel_code AS value , CONCAT(channel_code, '(', channel_name, ')') AS label FROM channel_info WHERE valid_flag != '00' AND check_flag = '01' ")
    List<ComboboxVo> selectValidChannelInfoCombobox();

    ChannelInfo selectValidChannelInfoByChannelCode(@Param("channelCode") String channelCode);

}